<?php
	class predaj extends BaseController{
		public $security_level = SECURITY_LEVEL_VENDOR;


		public function getData($in_params){
            $this->template_data["open"] = (time() > START_TIME);
            $reservation = new InteractiveReservation();
            $administration = new OrderAdministration();

            $this->template_data["userSeats"] =        json_encode($reservation->GetUserSeats());
            $this->template_data["reservedSeats"] =    json_encode($reservation->GetReservedSeats());
            $this->template_data["userOrderedSeats"] = json_encode($reservation->GetUserOrderedSeats());
            $this->template_data["reservation_mode"] =  json_encode("admin");
            $this->template_data["paid_seats"]= json_encode($administration->GetPaidSeat());
            general::debug("paidseats", json_encode($administration->GetPaidSeat()));

            return;
		}

        public function action_search($in_params = array()){
            general::debug("options", $in_params);
            general::debug("searchSet", isset($in_params['order_id']));
            $orders = new m_search_order_result();
            if(isset($in_params['order_id']) && $in_params['order_id'] != ""){
                $foundOrders = $orders-> select("",array("id"=>$in_params["order_id"]));
                general::debug("orders", $foundOrders);
                $this->template_data["foundOrders"] = $foundOrders;
                if (isset($foundOrders) && isset($foundOrders[0]) && $foundOrders[0]-> seats != "")
                {
                    $this->template_data["foundOrderSeats"] = json_encode(explode(';',$foundOrders[0]-> seats));
                    $this->template_data["foundOrderSeatsArray"] = explode(';',$foundOrders[0]-> seats);
                }
                else
                {
                    $this->template_data["foundOrderSeats"] = json_encode(array());
                    $this->template_data["foundOrderSeatsArray"] = array();
                }

                general::debug("orders", $this->template_data["foundOrderSeats"]);
            }
            else
            {
                $this->template_data["foundOrderSeats"] = json_encode(array());
            }


            return;
        }
	}
?>